import { AnyAction, createSlice } from "@reduxjs/toolkit"
import { Dispatch } from "react"

const layoutStore = createSlice({
    name: "layoutStore",
    initialState: {
        menuList: [],
    },
    reducers: {
        setMenuList: (state, action) => {
            state.menuList = action.payload
        },
    },  
})
const { setMenuList } = layoutStore.actions

const fetchMenuList = (date: any = {}) => {
    return async (dispatch: Dispatch<AnyAction>) => {
        // const res: any = await getMenuListAPI(date)
        // dispatch(setMenuList(res.data))
    }
}

const layoutStoreReducer = layoutStore.reducer

export { fetchMenuList, setMenuList }

export default layoutStoreReducer
